package com.cnap.db.entity;

import com.cnap.model.intelligent.IntelligentClusterInfo;
import com.cnap.model.schedule.engine.EngineClusterInfo;

import java.time.LocalDateTime;
import java.util.Objects;

/**
 * 微服务部署数据库模型
 *
 * @author xc
 **/
public class DeployClusterPO {
    private String id;
    private String serviceId;
    private String clusterName;
    private String providerName;
    private String accountName;
    private String ip;
    private String innerIp;
    private LocalDateTime createTime;

    /**
     * get
     *
     * @return AccountName
     */
    public String getAccountName() {
        return accountName;
    }

    /**
     * set
     *
     * @param accountName accountName
     */
    public void setAccountName(String accountName) {
        this.accountName = accountName;
    }

    /**
     * get
     *
     * @return Id
     */
    public String getId() {
        return id;
    }

    /**
     * set
     *
     * @param id id
     */
    public void setId(String id) {
        this.id = id;
    }

    /**
     * get
     *
     * @return ServiceId
     */
    public String getServiceId() {
        return serviceId;
    }

    /**
     * set
     *
     * @param serviceId serviceId
     */
    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    /**
     * get
     *
     * @return ClusterName
     */
    public String getClusterName() {
        return clusterName;
    }

    /**
     * set
     *
     * @param clusterName clusterName
     */
    public void setClusterName(String clusterName) {
        this.clusterName = clusterName;
    }

    /**
     * get
     *
     * @return ProviderName
     */
    public String getProviderName() {
        return providerName;
    }

    /**
     * set
     *
     * @param providerName providerName
     */
    public void setProviderName(String providerName) {
        this.providerName = providerName;
    }

    /**
     * get
     *
     * @return Ip
     */
    public String getIp() {
        return ip;
    }

    /**
     * set
     *
     * @param ip ip
     */
    public void setIp(String ip) {
        this.ip = ip;
    }

    /**
     * get
     *
     * @return InnerIp
     */
    public String getInnerIp() {
        return innerIp;
    }

    /**
     * set
     *
     * @param innerIp innerIp
     */
    public void setInnerIp(String innerIp) {
        this.innerIp = innerIp;
    }

    /**
     * get
     *
     * @return CreateTime
     */
    public LocalDateTime getCreateTime() {
        return createTime;
    }

    /**
     * set
     *
     * @param createTime createTime
     */
    public void setCreateTime(LocalDateTime createTime) {
        this.createTime = createTime;
    }

    /**
     * 转换成IntelligentClusterInfo
     *
     * @return 结果
     */
    public IntelligentClusterInfo toIntelligentClusterInfo() {
        if (Objects.isNull(this.clusterName)) {
            return null;
        }
        IntelligentClusterInfo clusterInfo = new IntelligentClusterInfo();
        clusterInfo.setClusterName(this.clusterName);
        clusterInfo.setProvider(this.providerName);
        return clusterInfo;
    }

    /**
     * 转换成IntelligentClusterInfo
     *
     * @return 结果
     */
    public EngineClusterInfo toEngineClusterInfo() {
        if (Objects.isNull(this.clusterName)) {
            return null;
        }
        EngineClusterInfo clusterInfo = new EngineClusterInfo();
        clusterInfo.setName(this.clusterName);
        clusterInfo.setProviderName(this.providerName);
        return clusterInfo;
    }
}
